#include <iostream>
#include <cmath>
using namespace std;

bool sushu(long long n)
{
    if (n == 2)
    {
        return true;
    }
    else
    {
        for (int i = 2; i <= n / 2 +1; i++)
        {
            if (n % i == 0)
            {
                return false;
            }
        }
        return true;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    long long n;
    bool cute;
    bool seen = false;
    long long count;
    while (cin >> n)
    {
        seen = false;
        cute = true;
        count = 0;
        if (n == 0)
        {
            break;
        }
        if( n==1)
        {
            cout << 1 << endl;
            continue;
        }
        if( n == 2)
        {
            cout << 2 << endl;
            continue;
        }
        for (int i = 2; i <= n/2 + 1; i++)
        {
            if (n % i == 0)
            {
                count++;
                if (sushu(i))
                {
                    seen = false;
                    if(i == 2)
                    {
                        seen = true;
                    }
                    if (i == 3)
                    {
                        seen = true;
                    }
                    if (i == 5)
                    {
                        seen = true;
                    }
                    if (i == 7)
                    {
                        seen = true;
                    }
                    if(!seen)
                    {
                        cute = false;
                        break;
                    }
                }
            }
        }
        if (cute)
        {
            cout << count + 2 << endl;
        }
    }
    return 0;
}